package asia.kalin.controller;

import asia.kalin.domain.ao.Result;
import asia.kalin.service.IDisposeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Kalin
 * @Name：DisposeController
 * @Date: 2025/3/11
 * @description
 */

@RestController
@RequestMapping("/dispose")
@RequiredArgsConstructor
public class DisposeController {

    private final IDisposeService disposeService;

    /**
     * 接手检测结果
     * @param resultId 检测结果id
     * @return Result
     */
    @GetMapping("/takeover")
    public Result disposeTakeOver(@RequestParam String resultId){
        return disposeService.takeOverResult(resultId);
    }

    /**
     * 放弃已经接手的检测结果
     * @param resultId 检测结果id
     * @return Result
     */
    @GetMapping("/calloff")
    public Result disposeCallOff(@RequestParam String resultId){
        return disposeService.callOffResult(resultId);
    }

    /**
     * 查询当前用户的已经结果的处理结果
     * @return Result
     */
    @GetMapping("/queryResolvedByUser")
    public Result disposeQuery(){
        return disposeService.getDisposeResolvedByUserId();
    }

    /**
     * 更新处理结果状态为解决
     * @param resultId 检测结果ID
     * @return Result
     */
    @PostMapping("/updateStateSolved")
    public Result updateStateSolved(@RequestParam String resultId){
        return disposeService.updateStateSolvedById(resultId);
    }

    /**
     * 查询当前正在处理的检测结果
     * @return Result
     */
    @GetMapping("/processingByUser")
    public Result getProcessingDispose(){
        return disposeService.getProcessingDisposeByUserId();
    }

    /**
     * 查询当前检测结果是否被接手
     * @param resultId 检测结果id
     * @return
     */
    @GetMapping("/isHaveUser")
    public Result isHaveUserById(@RequestParam String resultId){
        return disposeService.isHaveUserById(resultId);
    }
}
